CPP=riscv64-linux-gnu-g++
CC=riscv64-linux-gnu-gcc
CPPFLAGS=-Wall

all: run_u

hello_u:
	${CC} -march=rv64g -mabi=lp64 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -Tsifive_u/hello.ld -Isifive_u hello.s -o hello_u

run_u: hello_u
	qemu-system-riscv64 -nographic -machine sifive_u -bios none -kernel hello_u

.PHONY: all clean vim

vim:
	ctags -R
	cscope -Rbkq

clean:
	rm -rf $(OBJ)
	rm -rf cscope.in.out cscope.out cscope.po.out tags
